<%@page import="java.util.*"%>
<%@page import="java.text.*"%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%
    String path = request.getContextPath(); 
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+path+ "/"; 
%>
<!DOCTYPE HTML>
<html>
<head>
	<base href="<%=basePath%>">
	<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
	<title>意见反馈列表</title>
	<link rel="stylesheet" href="plugin/bootstrap-3.3.7-dist/css/bootstrap.min.css" />
	<link rel="stylesheet" href="css/bootstrap-datetimepicker.css" />
    <link rel="stylesheet" href="plugin/bootstrap-table/dist/bootstrap-table.css">
<style type="text/css">

ul{
    list-style-type: none;
}
 .breadcrumb{
          padding: 21px 25px;
       }    
  a {
    color: #2a3f54;
}      
</style>

</head>
<body>
    <div class="row base-margin" id="query">
        <ul class="breadcrumb">
				<li style="padding-left: 15px"><i class="icon-home home-icon"></i> <a href="javascript:void(0)">System Settings(系统设置)</a>
				</li>
				<li class="active">
				<a href="view/sys/feedback_list.jsp">Suggestions (建议反馈)</a></li>
        </ul>
        <form class="form-inline" role="form" style="float: left; width: 100%" method="post" id="queryForm">
           
           <div class="form-group">  
                <label for="bName">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Review time(反馈时间):</label> 
                <input type="text" class="form-control input-append form_date"  id="startTime" />-
                <input type="text" class="form-control input-append form_date"   id="endTime" />
            </div>   
             <div class="form-group">
                <label for="bName">Status(状态):</label> 
                 <select id='msgstat' class="form-control" >
                   <option value="">Total</option>
                    <option value="0">Not Complete</option>
                    <option value="3">Complete</option>
                 </select>
            </div> 
            <div class="form-group">
                <button type="button" id="queryBtn" onclick="doQuery1('demo-table',queryParams1());" class="btn btn-primary">Search(搜索)</button>
            </div> 
        </form>
    </div>
    <div class="container" style="width: 100%;margin-top:15px">
        <table id="demo-table">
        </table>
    </div>
</body>
	<!-- 加载需要的js -->
	<script src="js/jquery-3.2.1.min.js"></script>
	<script src="plugin/bootstrap-3.3.7-dist/js/bootstrap.min.js"></script>
	<script src="js/jquery-bootstrap-pagination.js"></script>
	<script src="plugin/bootstrap-table/dist/bootstrap-table.min.js"></script>
	<script src="plugin/bootstrap-table/dist/locale/bootstrap-table-zh-CN.min.js"></script>
	<!--时间  -->
	<script src="js/bootstrap-datetimepicker.js"></script>
	<script src="js/bootstrap-datetimepicker.zh-CN.js"></script>
	<script src="js/common.js"></script>
	<script src="plugin/layer/layer.js"></script>
	<script type="text/javascript" charset="utf-8">
	$(function () {
		initPath("<%=basePath%>");
	    initTable('demo-table',queryParams,columns,"sugFeedback/getList");
	});
	
	   $('.form_date').datetimepicker({
	        minView: "month", //选择日期后，不会再跳转去选择时分秒 
	        language: 'zh-CN',
	        format: 'dd/mm/yyyy',
	        todayBtn:  1,
	        autoclose: 1,
	    });
	   
	   var  columns= [ 
			 { field : 'id',  title : 'Operation(操作)',  align : 'center', valign : 'middle',formatter:function(value, row, index){
		    	 var str="";
		    	 if(row.msgstat==0){
		    		 str="Not Complete";
		    	 }else if(row.msgstat==3){
		    		 str="Complete"; 
		    	 }
		    	 return "<a style='color:blue'  onclick='pop("+row.id+","+row.msgstat+")'>"+str+"</a>";
		     }},
			  { field : 'name',  title : 'Review Account(反馈账号)',  align : 'center', valign : 'middle' }, 
			  { field : 'account',  title : 'Review Telephone(反馈电话)',  align : 'center', valign : 'middle' }, 
		     {  field : 'msgdate',  title : 'Review time(反馈时间)', align : 'center', valign : 'middle',formatter:timeStamp2String  },
		     { field : 'msgcontent', title : 'Feedback Content(反馈内容)', align : 'center', valign : 'middle' },
		  /*    { field : 'imgs', title : 'Photo(反馈图片)', align : 'center', valign : 'middle' }, */
		     {  field : 'msgstat',  title : 'Status(处理状态)', align : 'center', valign : 'middle',formatter:function(value, row, index){
		    	 var str="";
		    	 if(value==0){
		    		 str="Not Complete";
		    	 }else if(value==3){
		    		 str="Complete"; 
		    	 }
		    	 return str;
		     }  }
		     
		     /* { field : 'refund_amout', title : 'Refund Amount(退款金额)', align : 'center', valign : 'middle' },
		     { field : 'account', title : 'Operator(操作员)', align : 'center', valign : 'middle' } */
			 ];
/* var  columns= [ 
	 { field : 'name',  title : '用户名',  align : 'center', valign : 'middle'},
	 { field : 'msgtitle',  title : '反馈账号',  align : 'center', valign : 'middle' },
	
     {  field : 'msgdate',  title : '反馈时间', align : 'center', valign : 'middle',formatter:timeStamp2String  },
     { field : 'msgcontent', title : '反馈内容', align : 'center', valign : 'middle' },
     {  field : 'msgstat',  title : '处理状态', align : 'center', valign : 'middle',formatter:function(value, row, index){
    	 var str="";
    	 if(value==0){
    		 str="未处理";
    	 }else if(value==1){
    		 str="申报中"; 
    	 }else if(value==2){
    		 str="处理中"; 
    	 }else if(value==3){
    		 str="已处理"; 
    	 }
    	 return "<a onclick='pop("+row.id+","+value+")'>"+str+"</a>";
     }  },
     {  field : 'id',  title : '操作', align : 'center', valign : 'middle',formatter:function(value, row, index){
    	 return "<button type=\"button\" onclick='save("+value+")'>处理</button>"
     } },
	 ];
 */

 function pop(id,status){
		var str = "";
		 str+="<form class=\"form-horizontal\">"
			+"<div class=\"form-group\"><label  class=\"col-sm-4 control-label\">Status(处理状态)</label>"
			+"<div class='col-sm-6'>"
			+"<select id='msgstat' class=\"form-control\" >"
			+"<option value='0'>Not Complete</option><option value='3'>Complete</option></select>"
			+"<input type='hidden' id=\"id\"  value='"+id+"'/></div></div>"
			+"<div class=\"form-group\"><label  class=\"col-sm-4 control-label\">Notes(备注)</label><div class='col-sm-3'>"
			+"<textarea rows=\"3\" cols=\"20\" id=\"remark\"></textarea>"
			+"</div></div>"
			+"<div class=\"form-group\" style=\"padding-left: 10%\">"
			+" <button  onclick=\"save("+id+")\" class=\"btn btn-info\"style=\"width: 200px\">Save</button><button  onclick=\"cacel()\" style=\"width: 200px;margin-left:10px\" class=\"btn btn-info\">Cancel</button></div></form >";
			layer.open({
				  type: 1,
				  title: "Update status",
				  skin: 'layui-layer-rim', //加上边框
				  area: ['540px', '340px'], //宽高
				  content: str
				});
			$('#msgstat').val(status);
	}
 
 
	
 
	//
	function save(id){
		var data={"id":id,"msgstat":2};
		$.ajax({
			type:'post',
			url:"sugFeedback/addOrUpdate",
			 data: JSON.stringify(data),
             contentType:"application/json;charset=UTF-8", 
             dataType:"json",
             success: function(data){   
            	 if(data.code==200){
            		 doQuery1('demo-table',queryParams());
            		// doQuery1('demo-table',queryParams());
            	       }else{
            	    	    layer.msg(data.msg);
            	       }
             }
		});
	}
	
	
	function queryParams(params) {
		 console.log(params);  
	    var param = {
	    		startTime:$('#startTime').val(), 
	    		endTime:$('#endTime').val(),
	    		msgstat:$('#msgstat').val(),
	    		pageNo : this.pageNumber,
	        pageSize : this.pageSize
	    }	
	    return param;
	} 
	function queryParams1(){
		 var param = {
				 startTime:$('#startTime').val(), 
		    		endTime:$('#endTime').val(),
		    		msgstat:$('#msgstat').val(),
		        pageNo : 1,
		        pageSize : this.pageSize
		    }	
		    return param;
	}
	</script>
</html>


